﻿using Abcd.Customer.Application;
using Abcd.Customer.HttpApi.Client;
using Abcd.Order.Application;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Options;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Autofac;
using Volo.Abp.EventBus.RabbitMq;
using Volo.Abp.Http.Client;
using Volo.Abp.Modularity;

[DependsOn(
    typeof(AbpAspNetCoreMvcModule),
    typeof(AbpAutofacModule),
    typeof(AbcdOrderSwaggerModule),
    //typeof(AbpEventBusModule),
    typeof(AbpEventBusRabbitMqModule),

    typeof(AbcdOrderApplicationModule),
    typeof(AbcdCustomerApplicationModule)
    //typeof(AbcdCustomerHttpApiClientModule)
)]
public class AbcdOrderApiHostModule : AbpModule
{
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        var services = context.Services;
        // 配置动态控制器
        Configure<AbpAspNetCoreMvcOptions>(options =>
        {
            options.ConventionalControllers.Create(typeof(AbcdOrderApplicationModule).Assembly);
        });
      
    }

    public override void OnApplicationInitialization(ApplicationInitializationContext context)
    {
        var app = context.GetApplicationBuilder();
        var env = context.GetEnvironment();

        app.UseStaticFiles();
        app.UseRouting();
        app.UseAuthentication();
        app.UseAuthorization();

        app.UseAuditing();
        app.UseConfiguredEndpoints();
    }

}